package com.ruoyi.manage.controller;

import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.cg.pojo.Order;
import com.ruoyi.common.core.cg.pojo.User;
import com.ruoyi.common.core.cg.result.Queryparam;
import com.ruoyi.common.core.cg.result.Result;
import com.ruoyi.common.core.cg.vo.OrderVo;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.manage.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 马景昌
 * @create 2025/03/09
 * @description
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    @GetMapping("/pageorder")
    public Result pageorder(Integer pageNum, Integer pageSize, Order order){
        Result pageshow = orderService.pageshow(pageNum, pageSize, order);
        return pageshow;
    }
    @GetMapping(value = "/{oid}")
    public Result hx(@PathVariable("oid") Integer oid){
        Result result = orderService.hx(oid);
        return result;
    }
    @PutMapping("/update")
    public Result update(@RequestBody OrderVo order){
        Result result = orderService.update(order);
        return result;
    }
    @DeleteMapping("/{oid}")
    public Result delete(@PathVariable("oid") Integer oid){
        Result result = orderService.delete(oid);
        return result;
    }
    @PostMapping
    public Result add(@RequestBody Order order){
        Result result = orderService.add(order);
        return result;
    }
//    拼团点根据状态查询
    @GetMapping("/itemOrder0")
    public Result itemOrder0(Integer pageNum, Integer pageSize, Order order){
        Result result = orderService.itemOrder0(pageNum, pageSize, order);
        return result;
    }

    @RequestMapping("orderLike")
    public PageInfo<Order> orderlike(@RequestBody Queryparam queryparam){
        PageInfo<Order> orderPageInfo = orderService.orderLike(queryparam);
        return orderPageInfo;
    }

}
